#!/usr/bin/env python
# -*- coding:utf-8 -*-
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client
secret_id = 'AKIDyf8Llx9Yy97qJXuFjyylLhphJgnftmxt'  # 替换为用户的 secretId
secret_key = 'rTq1yjFhusb6MNAiz0mKceR0KNBk26uT'  # 替换为用户的 secretKey
region = 'ap-beijing'  # 替换为用户的 Region
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
client = CosS3Client(config)
# 上传文件
response = client.upload_file(
    Bucket='haoyunkai-1301491552',
    LocalFilePath='2.gif',  # 本地文件的路径
    Key='k1.gif'  # 上传到桶之后的文件名
)
print(response['ETag'])